from common.poium import Page
from common.vue.label import ElementType as ET
from common.vue.label import ElementBaseLabel, Map
from common.vue.search import VueSearch
from common.vue.button import VueButton
from common.vue.table import VueTable
from common.vue.region import VueRegion
from common.vue.float_window import FloatWindow


class SearchTools(VueSearch):
    region = ElementBaseLabel(ET.REGION, label="区域")

    def __init__(self):
        super(SearchTools, self).__init__()


class Table(VueTable):
    add_btn = VueButton("添加")

    def __init__(self):
        super(Table, self).__init__()


class AddGrid(FloatWindow):
    region = ElementBaseLabel(ET.REGION, label="区域")
    region_selector = VueRegion(index=1, region_level=5)
    grid_area = ElementBaseLabel(ET.TEXTAREA, label="网格范围")

    map = Map()

    def __init__(self, title=None, index=None):
        super(AddGrid, self).__init__(title=title, index=index)


class GridDataManagePage(Page):
    searchTools = SearchTools()
    table = Table()
    add_grid = AddGrid(title="添加网格")
